package com.suifeng.mq.common.utils;

import com.suifeng.mq.common.enums.Status;

public class ResponseMessage {
    private int code;
    private String msg;
    private Object data;
    public ResponseMessage(){

    }
    public static ResponseMessage ofSuccess(Object data){
        return new ResponseMessage(Status.SUCCESS.getCode(),Status.SUCCESS.getMessage(),data);
    }
    public static ResponseMessage ofStatus(Status status){
        return new ResponseMessage(status.getCode(),status.getMessage(),null);
    }
    public static ResponseMessage ofStatus(Status status,Object o){
        return new ResponseMessage(status.getCode(),status.getMessage(),o);
    }
    public ResponseMessage(int code, String msg, Object data){
        this.code=code;
        this.msg=msg;
        this.data=data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
